//
//  ActiVityDetailsViewController.m
//  豆瓣
//
//  Created by Roach on 16/6/25.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ActiVityDetailsViewController.h"
#import "ActivityViewController.h"
#import "ActivityModel.h"
#import "UIImageView+WebCache.h"

@interface ActiVityDetailsViewController ()

@end

@implementation ActiVityDetailsViewController

- (void)viewDidLoad {
    [self config];
    [self creat];
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)config {
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    
}

- (void)creat {
    UIScrollView *scroView =[[UIScrollView alloc]init];
    scroView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds));
    scroView.contentSize = CGSizeMake(CGRectGetWidth(self.view.bounds),2000 );
    [self.view addSubview:scroView];
    
    //时间图标
    UIImage *timeImage = [UIImage imageNamed:@"icon_date_blue@2x.png"];
    UIImageView *timeImageView = [[UIImageView alloc]initWithImage:timeImage];
    timeImageView.frame = CGRectMake(180, 105, 23, 23);
    [scroView addSubview:timeImageView];
    [timeImageView release];
    
    
    // 类型
    UIImage *categoryImage = [UIImage imageNamed:@"icon_catalog_blue@2x.png"];
    UIImageView *categoryImageView = [[UIImageView alloc]initWithImage:categoryImage];
    categoryImageView.frame = CGRectMake(180, 183, 23, 23);
    [scroView addSubview:categoryImageView];
    [categoryImageView release];
    
    //地点
    UIImage *addressImage = [UIImage imageNamed:@"icon_spot_blue@2x.png"];
    UIImageView *addressImageView = [[UIImageView alloc]initWithImage:addressImage];
    addressImageView.frame = CGRectMake(180, 223, 23, 23);
    [scroView addSubview:addressImageView];
    [addressImageView release];
    
    // 赞助商
    UIImage *nameImage = [UIImage imageNamed:@"icon_sponsor_blue@2x.png"];
    UIImageView *nameImageView = [[UIImageView alloc]initWithImage:nameImage];
    nameImageView.frame = CGRectMake(180, 143, 23, 23);
    [scroView addSubview:nameImageView];
    [nameImageView release];
    
    
    NSURL *url = [NSURL URLWithString:self.activityModel.image];
    
    UIImageView *activitylconView = [[UIImageView alloc]init];
    [activitylconView sd_setImageWithURL:url];
    activitylconView.frame = CGRectMake(10, 100, 160, 200);
    [scroView addSubview:activitylconView];
    [activitylconView release];
    
    
    
    // 标题
    UILabel *titleLaber = [[UILabel alloc]initWithFrame:CGRectMake(10, 10,390 , 80)];
    titleLaber.text = self.activityModel.title;
    titleLaber.numberOfLines = 2;
    titleLaber.font = [UIFont boldSystemFontOfSize:24.0f];
    [scroView addSubview:titleLaber];
    
    // 时间
    UILabel *timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 105, 200, 20) ];
    timeLabel.text = [NSString stringWithFormat:@"%@ -- %@", self.activityModel.begin_time, self.activityModel.end_time];
    timeLabel.font = [UIFont systemFontOfSize:13.0f];
    [scroView addSubview:timeLabel];
    
    // 赞助商
    UILabel *ownerLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 143, 200, 20)];
    ownerLabel.text = [self.activityModel.owner objectForKey:@"name"];
    [scroView addSubview:ownerLabel];
    
    // 类型
    UILabel *categoryLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 181, 200, 20)];
    categoryLabel.text = [NSString stringWithFormat:@"类型: %@", self.activityModel.category_name];
    [scroView addSubview:categoryLabel];
    
    // 地址
    UILabel *addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(210, 215, 200, 40) ];
    addressLabel.text = self.activityModel.address;
    addressLabel.numberOfLines = 2;
    [scroView addSubview:addressLabel];
    
    //
    UILabel *view = [[UILabel alloc]initWithFrame:CGRectMake(10, 320, 100, 50) ];
    view.text =@"活动介绍";
    view.font = [UIFont boldSystemFontOfSize:25.0f];
    [scroView addSubview:view];
    
    // 活动介绍
    UILabel *contentView = [[UILabel alloc]initWithFrame:CGRectMake(10, 400, 400, 1000) ];
    contentView.text = self.activityModel.content;
    //contentView.text = @"fkapfla";
    contentView.font = [UIFont systemFontOfSize:17];
    contentView.numberOfLines = 0;
    [scroView addSubview:contentView];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
